<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS_浮动</title>
    <style>
        *{
            padding: 0px;
            margin: 0px;
        }
        div{
            width: 1000px;
            height: 50px;
            border: 5px solid red;
            
        }
        p{
            width: 40px;
            height: 40px;
            margin: 5px 10px;
            color: #fff;
            text-align: center;
            line-height: 40px;
            background-color: green;
        }
        .left{
            float: left;
        }
        .right{
            float: right;
        }
    </style>
</head>
<body>
    <div>
        <p class="left">1</p>
        <p class="right">2</p>
        <p class="left">3</p>
        <p class="right">4</p>
        <p class="left">5</p>
        <p class="right">6</p>
        <p class="left">7</p>
        <p class="right">8</p>
        <p class="left">9</p>
        <p class="right">10</p>
    </div>
</body>
</html>